/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mapping;

import domain.Client;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Jasper
 */
public class ClientMapper {
    private List<Client> clients = new ArrayList<Client>();
    private List<Client> tekenaars = new ArrayList<Client>();
    private List<Client> raders = new ArrayList<Client>();
    
    public ClientMapper(){
        clients = new ArrayList<Client>();
    }
    
    public void addClient(String name, byte[] ipadress){
        Client c = new Client(name, ipadress);
        clients.add(c);
    }
    public List<Client> getRaders()
    {
        return raders;
    }
    
    public List<Client> getTekenaars()
    {
        return tekenaars;
    }
    public void addRader (Client c)
    {
        raders.add(c);
    }
    public void addTekenaar(Client c)
    {
        tekenaars.add(c);
    }
    
    public void updateClient(String naam, Client c)
    {
        Client client;
        for(Client x : clients){
            if(x.getNaam().equals(naam)){
                client = x;
            }
        }
        
        client = c;
    }
    
    public void removeVeranderenSoort(Client c, String soort)
    {
        if (soort.equalsIgnoreCase("rader"));
        { raders.remove(c);}
        if (soort.equalsIgnoreCase("tekenaar")){
                tekenaars.remove(c);}
    }
    
    
    private  byte[] ipadress = new byte[4];
    
    public void removeClient(String name){
        
        clients.indexOf(name);
    }
    
    public List<Client> getClients(){
        return clients;
    }
    
    public void addTekenaar(String name){
        
    }
    
    public void addRader(String name){
        
    }
    
    public List<Client> getClients(String type){
        List<Client> clients = new ArrayList<Client>();
        for(Client c : clients){
            if(c.getSoort().equals(type)){
                clients.add(c);
            }
        }
        return clients;
    }
    
    
    public Client getClient(String name) {
        for(Client c : clients){
            if(c.getNaam().equals(name)){
                return c;
            }
        }
        return null;
    }
}
